<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/hello', function () {
    return view('web');
});

Route::get('/home',function(){
    return view('welcome');
});

//Route::get('/admin', function () {
//    return redirect('admin/index');
//});

Route::get('home/test', ['as' => 'home.home', 'uses'=>'Home\\HomeController@test']);

Route::get('home/index', ['as' => 'home.home', 'uses'=>'Home\\HomeController@index']);

Route::post('home/testdata', ['as' => 'home.home', 'uses'=>'Home\\HomeController@testdata']);

Route::get('home/del', ['as' => 'home.home', 'uses'=>'Home\\HomeController@del']);

Route::get('home/edit', ['as' => 'home.home', 'uses'=>'Home\\HomeController@edit']);

Route::post('home/update', ['as' => 'home.home', 'uses'=>'Home\\HomeController@update']);




Route::get('/hello/{name}',function($name){
    return "Hello {$name}!";
});

//Route::get('admin/index', ['as' => 'admin.index', 'middleware' => ['auth','menu'], 'uses'=>'Admin\\IndexController@index']);



/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

//Route::group(['middleware' => ['web']], function () {
//    //
//});


/*后台管理部分处理*/
Route::Group(['prefix'=>'admin','namespace'=>'Admin'],function(){
    /*用户登陆*/
    Route::match(['get','post'],'login',['as'=>'admin.account.login','uses'=>'AccountController@login']);

    /*用户退出*/
    Route::get('logout',['as'=>'admin.account.logout','uses'=>'AccountController@logout']);

    /*首页*/
    Route::resource('index', 'IndexController', ['only' => ['index']]);
});